/***********************************************************
** Project    : basic IO programming
** Category   : Tutorial ARM
** MCU        : STM32F103RCT6
** Create Date: 18/3/2013
** Finish Date: 18/3/2013
** Author     : VietComp Electronics
** Email      : support@vietcomp.com.vn
** Website    : www.vietcomp.com.vn
************************************************************/
/***********************************************************
**    INCLUDES
************************************************************/
#include "global.h"
/******************************************************************************/
/* DECLARATION OF VARIABLES OF MODULE                                         */
/* Declaration of local variables shall have the specifier STATIC             */
/******************************************************************************/
static uint32_t SystemTick = 0;
static __IO uint32_t TimingDelay = 0;
/***********************************************************
** Function Name: VP_GlobalGetSystick()
** Description  : The function get value of system tick
** Parameter    : None
** Return       : None
** Remark       : main();
************************************************************/
uint32_t VP_GlobalGetSystick(void)
{
	return SystemTick;
}
/***********************************************************
** Function Name: VP_IncrementSystick()
** Description  : The function increment of systick
** Parameter    : None
** Return       : None
** Remark       : global
************************************************************/
void VP_IncrementSystick(void)
{
	SystemTick++;
}
/***********************************************************
** Function Name: VP_DelayMs()
** Description  : The function make delay minisecond
** Parameter    : None
** Return       : None
** Remark       : global
************************************************************/
__IO void VP_DelayMs(uint32_t nTime)
{
	TimingDelay = nTime;
	while(TimingDelay != 0);
}
/***********************************************************
** Function Name: VP_DelayUs()
** Description  : The function make delay microsecond
** Parameter    : None
** Return       : None
** Remark       : global
************************************************************/
void VP_DelayUs(uint32_t nTime)
{
	TimingDelay = nTime;
	while(TimingDelay>0);
}
/***********************************************************
** Function Name: VP_DecrementTimingDelay()
** Description  : The function make delay microsecond
** Parameter    : None
** Return       : None
** Remark       : global
************************************************************/
void VP_DecrementTimingDelay(void)
{
	/* check TimingDelay is > 0 */
	if(TimingDelay>0)
	{
		/* decrement value */
		TimingDelay--;
	}
	else
	{
		/* do nothing */
	}
}
/********************** End of file *************************/
/*									Copyright Cuong Chu 2013                */
/************************************************************/
